package com.itheima.reggie.exception;

import com.itheima.reggie.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @className: AllExceptionAdvice
 * @author: 开水青菜
 * @data: 2022/12/29 14:55
 */

@RestControllerAdvice
@Slf4j
public class AllExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public R exceptionAdvice(Exception ex){
        log.error("出现异常：" + ex.getMessage());
        return R.error(ex.getMessage());
    }
}
